
<?php 
$RealOrderId = $this->getOrderId();
$orders = Mage::getSingleton('checkout/session')->getLastRealOrder();
$items = $orders->getAllItems();
?>
<div class="page-head">
    <h3><?php echo $this->__('Your payment is succeed!Your order has been received') ?></h3>
    <div class="success-msg" ><?php echo $_SESSION['orderInfo'];?></div>
</div>
<div>
	<img src="<?php echo $this->getSkinUrl('images/custom/repayment_success.png')?>"/>
	<h3>Your order has been received.</h3>
	<h4>Thank you for your purchase!</h4>
	<span>Your order has been payed successfully.</span>
	<p>
		You will receive an order confirmation email with details of your order and a link to track its progress.
	</p>
</div>


<script>
//wang google
   ga('set', '&cu', '<?php echo $orders->getBaseCurrencyCode()?>');
	<?php foreach ($items as $_item){
	    if ($_item->getParentItem()) continue;
	    ?>
    ga('ec:addProduct', {
      'id': "<?php echo $_item->getSku();?>",
      'name': '<?php echo addslashes($_item->getName());?>',
      'category': "",
      'brand': '<?php echo $_item->getCommonBrand();?>',
      'variant':  '',
      'price': '<?php echo $_item->getBaseRowTotal();?>',
      'quantity': '<?php echo $_item->getQtyOrdered();?>'
    });
    <?php }?>
	// Transaction level information is provided via an actionFieldObject.
	ga('ec:setAction', 'purchase', {
	  'id': "<?php echo $RealOrderId?>",
	  'affiliation': 'rumall Store - Online',
	  'revenue': "<?php echo $orders->getBaseSubtotal()?>",
	  'tax': "<?php echo $orders->getBaseTaxAmount() ?>",
	  'shipping': "<?php echo $orders->getBaseShippingAmount()?>",
	  'coupon': "<?php echo $orders->getBaseCouponCode() ?>"    // User added a coupon at checkout.
	});
	ga('send', 'pageview');  
 </script>
<!-- Facebook Pixel Code -->
 <script type="text/javascript">
   //fbq('track', 'Purchase', {
   // content_type: 'product', //either 'product' or 'product_group'
   // content_ids: [<?php foreach ($items as $_item){if ($_item->getParentItem()) continue;echo "'".$_item->getSku()."',";}?>], //array of one or more product ids in the page
   // value: <?php echo $orders->getBaseSubtotal()?>, //REQUIRED
  //  currency: 'USD' //REQUIRED
//});
 dataLayer.push({
	    "ecommerce": {
	        "purchase": {
	            "actionField": {
	                "id" : '<?php echo $RealOrderId?>',
	            },
	            "products": [
<?php foreach ($items as $_item){
    if ($_item->getParentItem()) continue;
    ?>
	                {
	                    "id": "<?php echo $_item->getId();?>",
	                    "name": '<?php echo addslashes($_item->getName());?>',
	                    "price": '<?php echo $_item->getBaseRowTotal();?>',
	                    "brand": '<?php echo $_item->getCommonBrand();?>',
	                    "quantity":'<?php echo $_item->getQtyOrdered();?>',
	                },
  <?php }?>
	            ]
	        }
	    }
	});
 </script>
 <!-- cpa 联盟代码统计 -->
 <script type="text/javascript">
    window.ad_order = "<?php echo $RealOrderId?>";    // required
    window.ad_amount = "<?php echo $orders->getBaseSubtotal()?>";
    
    window.ad_products = [
    	<?php foreach ($items as $_item){
    	    if ($_item->getParentItem()) continue;
    	    ?>
   	{
        "id": '<?php echo $_item->getSku();?>',
        "number": <?php echo $_item->getQtyOrdered();?>,
    },
    <?php }?>
    ];

    window._retag = window._retag || [];
    window._retag.push({code: "9ce8887752", level: 4});
    (function () {
        var id = "admitad-retag";
        if (document.getElementById(id)) {return;}
        var s = document.createElement("script");
        s.async = true; s.id = id;
        var r = (new Date).getDate();
        s.src = (document.location.protocol == "https:" ? "https:" : "http:") + "//cdn.lenmit.com/static/js/retag.min.js?r="+r;
        var a = document.getElementsByTagName("script")[0]
        a.parentNode.insertBefore(s, a);
    })()
</script>
 
 <!-- cpa 联盟代码统计 -->
 
 
<?php
//注销session里的重新支付留下的repaymentorderid和isrepayment变量
if(!(Mage::getSingleton("core/session")->getData("isrepayment")) == null){
	Mage::getSingleton("core/session")->unsetData("isrepayment");
}
if(!(Mage::getSingleton("core/session")->getData("repay_IncrementId")) == null){
	Mage::getSingleton("core/session")->unsetData("repay_IncrementId");
}
?>